package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.EvStatistics;
import com.ruoyi.system.service.IEvStatisticsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 统计与报Controller
 * 
 * @author wtd1
 * @date 2025-11-15
 */
@RestController
@RequestMapping("/system/statisticsofwtd")
public class EvStatisticsController extends BaseController
{
    @Autowired
    private IEvStatisticsService evStatisticsService;

    /**
     * 查询统计与报列表
     */
    @PreAuthorize("@ss.hasPermi('system:statisticsofwtd:list')")
    @GetMapping("/list")
    public TableDataInfo list(EvStatistics evStatistics)
    {
        startPage();
        List<EvStatistics> list = evStatisticsService.selectEvStatisticsList(evStatistics);
        return getDataTable(list);
    }

    /**
     * 导出统计与报列表
     */
    @PreAuthorize("@ss.hasPermi('system:statisticsofwtd:export')")
    @Log(title = "统计与报", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EvStatistics evStatistics)
    {
        List<EvStatistics> list = evStatisticsService.selectEvStatisticsList(evStatistics);
        ExcelUtil<EvStatistics> util = new ExcelUtil<EvStatistics>(EvStatistics.class);
        util.exportExcel(response, list, "统计与报数据");
    }

    /**
     * 获取统计与报详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:statisticsofwtd:query')")
    @GetMapping(value = "/{statId}")
    public AjaxResult getInfo(@PathVariable("statId") Long statId)
    {
        return success(evStatisticsService.selectEvStatisticsByStatId(statId));
    }

    /**
     * 新增统计与报
     */
    @PreAuthorize("@ss.hasPermi('system:statisticsofwtd:add')")
    @Log(title = "统计与报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EvStatistics evStatistics)
    {
        return toAjax(evStatisticsService.insertEvStatistics(evStatistics));
    }

    /**
     * 修改统计与报
     */
    @PreAuthorize("@ss.hasPermi('system:statisticsofwtd:edit')")
    @Log(title = "统计与报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EvStatistics evStatistics)
    {
        return toAjax(evStatisticsService.updateEvStatistics(evStatistics));
    }

    /**
     * 删除统计与报
     */
    @PreAuthorize("@ss.hasPermi('system:statisticsofwtd:remove')")
    @Log(title = "统计与报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{statIds}")
    public AjaxResult remove(@PathVariable Long[] statIds)
    {
        return toAjax(evStatisticsService.deleteEvStatisticsByStatIds(statIds));
    }
}
